package com.feng.springcloud.controller;

import com.feng.springcloud.entities.Dept;
import com.feng.springcloud.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * title: provider-dept-8001: 部门服务提供者controller
 * author: feng
 * date: 2021-12-15 20:28
 * http://localhost:8001/dept/get/1
 */
@RestController
public class DeptController {
    @Autowired
    DeptService deptService;

    @RequestMapping(value = "/dept/add",method = RequestMethod.POST)
    public boolean add(@RequestBody Dept dept){
        return deptService.add(dept);
    }

    @RequestMapping(value = "/dept/get/{id}",method = RequestMethod.GET)
    public Dept get(@PathVariable("id")Long id){
        return deptService.get(id);
    }

    @RequestMapping(value = "/dept/list",method = RequestMethod.GET)
    public List<Dept> deptList(){
        return deptService.list();
    }


}
